package org.example.MyAdvice;

import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.stereotype.Component;
//定义通知类受Spring容器管理，并定义当前类为切面类
@Component
@Aspect
public class MyAdvice {
    //绑定切入点与通知的关系
    @Before("pt()")
    public void before(){
        System.out.println(System.currentTimeMillis());
    }


    //切入点
    @Pointcut("execute(void org.example.dao.BookDao.update())")
    private void pt() {}
    @Pointcut("execute(void org.example.dao.BookDao.save())")
    private void ptx(){}
}
